package com.md.lesson8;

import java.util.Scanner;

public class Figure {
	public static double tArea() {
		Scanner s = new Scanner(System.in);
		System.out.println("请输入底：");
		double bottom = s.nextDouble();
		
		System.out.println("请输入高：");
		double height = s.nextDouble();
		
		double tArea = (bottom*height)/2;
		
		System.out.println("三角形面积是：" + tArea);
		return tArea;
	}
	public static double sArea(double l,double w) {
		double result = l*w ;
		System.out.println("长方形的面积是：" + result);
		
		return result;
	}
	public static double rArea(double l) {
		double result = l*l;
		return result;
	}
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		double result1 = tArea();
		System.out.println("输入长方形的长：");
		double l = s.nextDouble();
		System.out.println("输入长方形的宽：");
		double w = s.nextDouble();
		double result2 = sArea(l,w);
		
		System.out.println("输入正方形的边长：");
		double l2 = s.nextDouble();
		
		double result3 = rArea(l2);
		
		double resultFinal = result1 + result2 + result3;
		System.out.println("正方形的面积是：" + result3);
		System.out.println("面积之和是:" + resultFinal);
		
	}

}
